import type { AxiosResponse } from 'axios'
import request from '@/utils/request'

const serviceName = import.meta.env.VITE_APP_SREVICE_NAME_CITY_MANAGEMENT

/**
 * 新建消息页接口
 */
class MsgSendServe {
  /**
   * 上传附件
   */
  fileUpload<T = any>(params: FormData): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/cgjybzMessage/fileUpload`,
      method: 'post',
      data: params
    })
  }
  /**
   * 发送消息
   */
  sendMessage<T = any>(params: RecordType): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/cgjybzMessage/sendMessage`,
      method: 'post',
      data: params,
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    })
  }
  /**
   * 搜索用户
   */
  queryUser<T = any>(params: RecordType): Promise<AxiosResponse<T>> {
    return request({
      url: `${serviceName}/sys/user/queryUser`,
      method: 'get',
      params
    })
  }
}

export default new MsgSendServe()
